package com.gzyj.jtt808.v2019.model.gps.additionalInfo;



import com.gzyj.jtt808.utils.HexBytesUtil;
import com.gzyj.jtt808.v2011.additionalinfo.JTT808_AddtionalInfo;
import io.netty.buffer.ByteBuf;
import lombok.Data;

import java.io.Serializable;

/**
 * 胎压
 *
 * @author lhj
 */
@Data
public class JTT808_0x0200_0x05 extends JTT808_AddtionalInfo implements Serializable {

    private byte[] TirePressure;

    public JTT808_0x0200_0x05() {
        this.setID(0x05);
        this.setLength(30);
    }

    @Override
    public void encode(ByteBuf buf) {
        buf.writeByte(this.getID());
        buf.writeByte(this.getLength());
        buf.writeBytes(this.TirePressure);
    }

    @Override
    public JTT808_0x0200_0x05 decode(ByteBuf buf) {
        this.setLength(buf.readByte());
        this.TirePressure= HexBytesUtil.readByOffset(buf,this.getLength());
        return this;
    }
}
